package cn.wolfcode.domain;

import cn.wolfcode.Utils.JsonUtil;
import cn.wolfcode.statusenum.AppointmentStatusEnum;
import lombok.*;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

@Setter
@Getter
@NoArgsConstructor
@AllArgsConstructor
@ToString
public class Appointment {
    private Long id;

    private String ano;

    private Integer status;

    private Long category_id;

    private SystemDictionaryItem category;

    private String info;

    private String contact_tel;

    private String contact_name;

    private Long business_id;

    private Business business;

    private Date create_time;

    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
    private Date appointment_time;
    
    public String getJson()throws Exception{
        return JsonUtil.convert(this,Appointment.class,"yyyy-MM-dd HH:mm");
    }

    public String getStatusName(){
        return AppointmentStatusEnum.getName(this.status);
    }

}